<?php $izdelkiHelper = $this->getHelper('Izdelki'); ?>
<div id="view-content">
	<!--<p>View script for controller <b>Seznam</b> and script/action name <b>podrobnosti</b></p>-->
   
    <?php $strankeSession = new Zend_Session_Namespace('Store_Stranke');
        
        $id = $strankeSession->productId;
        
    ?>
    
    <?php 
            
           $izdelek = new Application_Model_Izdelki();

           $izdelkiMapper = new Application_Model_IzdelkiMapper();
           
           $izdelkiMapper->find ($id, $izdelek);
            
            
            ?>
    <table id="izdelki-grid" class="table">
        <tr>
            <th>Slika</th><th>Ime izdelka</th><th>Cena</th><th>Zaloga</th><th>Dodaj v kosarico</th>
        </tr>
         
            <tr>
                <td>
                    <img src="<?php echo $this->baseUrl() ."/". $izdelek->getBaseImage() ?>" width="400"/>
                    <br />
                    <span>Ocena izdelka: <div class="rating-stars">
                        <div class="rating-stars-active" style="width: <?php echo ($izdelek->getPovprecnaOcena()/5)*100 ?>px"></div>
                    </div>
                    </span>
                </td>
                <td><?php echo $izdelek->getIme() ?></td>
                <td><?php echo $izdelek->getCena().' €' ?></td>
                <td><?php echo $izdelek->getZaloga().' kosov' ?></td>
                <?php if ($strankeSession->strankaId): ?>
                    <td><a href="<?php echo $izdelek->getDodajKosaricaUrl($this->baseUrl()) ?>"> Dodaj</a></td>
                <?php else :?>
                    <td>Za nakup potrebna prijava!</td>
                <?php endif; ?>          
            </tr>
          
    </table>
    <?php if ($strankeSession->strankaId): ?>
        <h2>Oceni izdelek</h2>
    <?php $form = new Application_Form_OcenaForm(); ?>
    <?php $form->setDefaults(array('produktid' => $izdelek->getIdProdukt())) ?>
    <?php $form->setAction($this->baseUrl() ."/seznam/oceni") ?>
    <?php echo $form; ?>
    <?php endif; ?>
</div>